package com.eshop.we.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.eshop.we.accountdetail.dto.AccountDetailDto;
import com.eshop.we.mapper.SuggestMapper;
import com.eshop.we.suggest.api.SuggestService;
import com.eshop.we.suggest.dto.SuggestDto;
import com.eshop.we.suggest.entity.Suggest;
import com.eshop.we.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Service(interfaceClass = SuggestService.class)
@Component
public class SuggestServiceImpl extends ServiceImpl<SuggestMapper, Suggest> implements SuggestService {

    @Override
    public Page selectSuggestPage(Page<SuggestDto> page, String name, String mobile, String startDate, String endDate) {
        Long start=null;
        Long end=null;
        try{
            start= startDate!=null? DateUtil.str2Date(startDate+" 00:00:00").getTime():null;
            end= endDate!=null?DateUtil.str2Date(endDate+" 23:59:59").getTime():null;
        }catch (Exception e){
            e.printStackTrace();
        }
        List<SuggestDto> list=baseMapper.selectSuggestPage(page,name,mobile,start,end);
        page.setRecords(list);
        return page;
    }
}
